package com.demo.http;

import java.util.Properties;

public class JobConf extends Properties {

	private static final long serialVersionUID = 1L;
	
	public static final String CONF_JOB_SCHEDULER = "job.scheduler";	
	public static final String CONF_JOB_TYPE = "job.type";
	public static final String CONF_JOB_ID = "job.id";
	public static final String CONF_JOB_RUNSERVER = "job.runserver";
	public static final String CONF_JOB_COST = "job.cost";
	public static final String CONF_ACTION_TYPE = "dw.action.type";
	public static final String CONF_CALLBACK_URL = "job.end.notification.url";
	
	public static final String DIST_FROM="dist_from_path";
	public static final String DIST_TO="dist_to_path";
	
	public static final String JOB_TYPE_CMD="COMMAND";
	public static final String JOB_TYPE_DIST="DISTRIBUTION";
	public static final String JOB_TYPE_DIST_UPLOAD="DISTRIBUTION_UPLOAD";
	
	public JobConf() {
		super();
	}
	
	public String get(String key) {
		return this.getProperty(key);
	}
	
	public String get(String key, String defaultValue) {
		return this.getProperty(key, defaultValue);
	}
	
	public void set(String key, String value) {
		this.setProperty(key, value);
	}
	
	public String getJobScheduler() {
		return this.getProperty(CONF_JOB_SCHEDULER);
	}
	
	public Object setJobScheduler(String jobScheduler) {
		return this.setProperty(CONF_JOB_SCHEDULER, jobScheduler);
	}
	
	public String getJobType() {
		return this.getProperty(CONF_JOB_TYPE);
	}
	
	public Object setJobType(String jobType) {
		return this.setProperty(CONF_JOB_TYPE, jobType);
	}
	
	public String getJobId() {
		return this.getProperty(CONF_JOB_ID);
	}
	
	public Object setJobId(String jobId) {
		return this.setProperty(CONF_JOB_ID, jobId);
	}
	
	public String getEndNotificationUrl() {
		return this.getProperty(CONF_CALLBACK_URL);
	}
	
	public Object setEndNotificationUrl(String endNotificationUrl) {
		return this.setProperty(CONF_CALLBACK_URL, endNotificationUrl);
	}
	
	public String getRunServer() {
		return this.getProperty(CONF_JOB_RUNSERVER);
	}
	
	public Object setRunServer(String runServer) {
		return this.setProperty(CONF_JOB_RUNSERVER, runServer);
	}
	
	public int getJobCost() {
		return Integer.parseInt(this.getProperty(CONF_JOB_COST));
	}
	
	public Object setJobCost(int cost) {
		return this.setProperty(CONF_JOB_COST, cost + "");
	}

	public int getActionType() {
		return Integer.parseInt(this.getProperty(CONF_ACTION_TYPE));
	}
	
	public Object setActionType(int actionType) {
		return this.setProperty(CONF_ACTION_TYPE, actionType + "");
	}
	
	public Object setDistFrom(String from){
		return this.setProperty(DIST_FROM, from);
	}
	
	public String getDistFrom(){
		return this.getProperty(DIST_FROM);
	}
	
	public Object setDistTo(String to){
		return this.setProperty(DIST_TO, to);
	}
	
	public String getDistTo(){
		return this.getProperty(DIST_TO);
	}
}

